﻿using MB.Orm.DB;
using Model;
using Public.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Business
{
   public class OrderService
    {
       public List<T> GetMainOrderList<T>(OrderTableEnum OrderTable,params object[] parValues)
       {
           List<T> list=null;
           switch (OrderTable)
           { 
               case OrderTableEnum.ESCORDERINFO:
                   using (var DbScope = new OperationDatabaseScope(new OperationDatabaseContext("MySql")))
                   {
                        list = PagedDatabaseExcuteByXmlHelper.NewInstance.GetPagedObjectsByXml4<T>
                                                       ("Order", "GetMainOrderList", parValues);
                       
                   }
                   break;
               case OrderTableEnum.SALEORDER:
                   using (var DbScope = new OperationDatabaseScope(new OperationDatabaseContext("NewWeb")))
                   {
                        list = PagedDatabaseExcuteByXmlHelper.NewInstance.GetPagedObjectsByXml4<T>
                                                       ("Order", "GetSaleOrderList", parValues);
                       
                   }
                   break;
               case OrderTableEnum.SALEAPP:
                 using (var DbScope = new OperationDatabaseScope(new OperationDatabaseContext("NewWeb")))
                   {
                        list = PagedDatabaseExcuteByXmlHelper.NewInstance.GetPagedObjectsByXml4<T>
                                                       ("Order", "GetSaleAppList", parValues);
                       
                   }
                   break;

           }
           return list;
            
       }
    }
}
 